﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NET.Tools.OS;
using System.IO;

namespace ResolutionManager
{
    [Serializable]
    public class ResolutionData
    {
        public ResolutionData(DisplayScreen screen)
        {
            Width = screen.ScreenWidth;
            Height = screen.ScreenHeight;
            Frequency = screen.ScreenFrequency;
        }

        internal ResolutionData(BinaryReader reader)
        {
            Width = reader.ReadInt32();
            Height = reader.ReadInt32();
            Frequency = reader.ReadInt32();
        }

        public int Width {get; private set;}
        public int Height { get; private set; }
        public int Frequency { get; private set; }

        internal void Save(BinaryWriter writer)
        {
            writer.Write(Width);
            writer.Write(Height);
            writer.Write(Frequency);
        }

        public bool Equals(DisplayScreen screen)
        {
            return
                screen.ScreenWidth == Width &&
                screen.ScreenHeight == Height &&
                screen.ScreenFrequency == Frequency;
        }
    }
}
